c = []
for i in range(2, 1000):
    a =1
    for b in range(2,i//2):
        if i%b==0:
            a=0
            break
    if a:
        c.append(i)

num = ['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine']
p = input().replace('9', '&').replace('8', '&').replace('7', '&').replace('6', '&')\
     .replace('5', '&').replace('4', '&').replace('3', '&').replace('2', '&')\
     .replace('1', '&').replace('0', '&')
if not(len(p.split())==3) or "&" in p:
    print('Wrong input')

else:
    d = p.split()
    new = ''
    for i in d:
        new += str(num.index(i))
    grate_maks = int(new)

    w = []
    for i in c:
        w.append([abs(grate_maks - i), i])

    print(sorted(w)[0][1])



